import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ArticeUsageVO, ArticeUsageForm, ArticeUsageQuery } from '@/api/logic/articeUsage/types';

/**
 * 查询网站文章使用列表
 * @param query
 * @returns {*}
 */

export const listArticeUsage = (query?: ArticeUsageQuery): AxiosPromise<ArticeUsageVO[]> => {
  return request({
    url: '/logic/articeUsage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询网站文章使用详细
 * @param id
 */
export const getArticeUsage = (id: string | number): AxiosPromise<ArticeUsageVO> => {
  return request({
    url: '/logic/articeUsage/' + id,
    method: 'get'
  });
};

/**
 * 新增网站文章使用
 * @param data
 */
export const addArticeUsage = (data: ArticeUsageForm) => {
  return request({
    url: '/logic/articeUsage',
    method: 'post',
    data: data
  });
};

/**
 * 修改网站文章使用
 * @param data
 */
export const updateArticeUsage = (data: ArticeUsageForm) => {
  return request({
    url: '/logic/articeUsage',
    method: 'put',
    data: data
  });
};

/**
 * 删除网站文章使用
 * @param id
 */
export const delArticeUsage = (id: string | number | Array<string | number>) => {
  return request({
    url: '/logic/articeUsage/' + id,
    method: 'delete'
  });
};
